﻿namespace WcfFlightRoutingService
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.Text;
    using Model_Layer;
    using Business_Logic_Layer;
    
    public class Service : IService
    {
        private static BLLFlight bllFlight = new BLLFlight();
        private static BLLAirport bllAirport = new BLLAirport();
        private static BLLDijkstraWIds bllDijkstraWIds = new BLLDijkstraWIds();
        private static BLLDijkstra bllDijkstra = new BLLDijkstra(); 

        public Flight GetSelectedFlight(int idflight)
        {
            return bllFlight.getSelectedFlight(idflight);
        }

        public List<Airport> GetAllAirports()
        {
            return bllAirport.GetAllAirports();
        }

        public Airport GetSelectedAirport(int idairport)
        {
            return bllAirport.GetSelectedAirport(idairport);
        }

        public List<Airport> SearchAllAirports(string search) 
        {
            return bllAirport.searchAllAirports(search);
        }

        public List<Flight> GetAllFlights(bool retrieveAssociation)
        {
            return bllFlight.GetAllFlights(retrieveAssociation);
        }

        public List<Flight> GetCriteriaFlights(string wClause, bool retrieveAssociation)
        {
            return bllFlight.GetCriteriaFlights(wClause, retrieveAssociation);
        }

        public List<Airport> GetAdjAirportList(int idairport)
        {
            return bllAirport.GetAdjAirportList(idairport);
        }

        public List<int> GetAdjIdAirportList(int idairport)
        {
            return bllAirport.GetAdjIdAirportList(idairport);
        }

        public List<Airport> RunDijkstra(Airport source, Airport target, string wClause, int deviationDays)
        {
            return bllDijkstra.RunDijkstra(source, target, wClause, deviationDays);
        }

        public List<Airport> RunBllDijkstra(Airport source, Airport target, string wClause)
        {
            return bllDijkstraWIds.RunDijkstra(source, target, wClause);
        }

        //public List<Airport> BacktrackDijkstra(Airport target, List<Airport> dijkstraSolutionList)
        //{
        //    return blldijkstra.BacktrackDijkstra(target, dijkstraSolutionList);
        //}
    }
}
